<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="script-tags-for-development.js"></script>
<script>
var app = angular.module('myApp', ['ngMap']);
app.controller('LayerDataEventCtrl', function(NgMap) {
  var vm = this;
  NgMap.getMap().then(function(map) {
    vm.map = map;
  });
  vm.styleFunc = function(feature) {
    var color = 'gray';
    if (feature.getProperty('isColorful')) {
      color = feature.getProperty('color');
    }
    return /** @type {google.maps.Data.StyleOptions} */({
      fillColor: color,
      strokeColor: color,
      strokeWeight: 2
    });
  };

  vm.onClick= function(event) {
    event.feature.setProperty('isColorful', true);
  };

  vm.onMouseover = function(event) {
    vm.map.data.revertStyle();
    vm.map.data.overrideStyle(event.feature, {strokeWeight: 8});
  };

  vm.onMouseout = function(event) {
    vm.map.data.revertStyle();
  };
});
</script>
</head>
<body>
  <div ng-controller="LayerDataEventCtrl as vm">
    <ng-map zoom="4" center="-28, 137.883">
      <map-data
        set-style="vm.styleFunc"
        on-click="vm.onClick()"
        on-mouseover="vm.onMouseover()"
        on-mouseout="vm.onMouseout()"
        load-geo-json="https://storage.googleapis.com/maps-devrel/google.json">
      </map-data>
    </ng-map>
    <h1>{{letter}}</h1>
  </div>
</body>
</html>
